home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Trusted Irix /B 4.0.4
/
Trusted-Irix B-4.0.1.iso
/
dist
/
eoe1.idb
/
usr
/
include
/
sys
/
gfx.h.z
/
gfx.h
Wrap
C/C++ Source or Header
|
1992-04-03
|
10KB
|
326 lines
#ifndef __SYS_GFX_H__
#define __SYS_GFX_H__
/**************************************************************************
* Copyright (C) 1990, Silicon Graphics, Inc. *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
**************************************************************************/
/*
* $Revision: 1.68 $
*/
/*
* I_STR ioctl commands for gfx STREAMS
*
* All Gfx ioctls share the same cmd token space to
* avoid unnecessary indirections.
*
* There are three types of ioctl.
* - GFX device independant gfx operations (defined here)
* - RRM rendering resource manager commands (defined in rrm.h)
* - Graphics board specific cmds (defined in a board-specific header e.g. gr1.h)
*/
#ifndef NULL
#define NULL 0
#endif
/*
* GFX commands
*/
#define GFX_SYNC (1)
#define GFX_BOARD_SYNC (10)
#define GFX_BASE 100
#define GFX_GETNUM_BOARDS (GFX_BASE+1)
#define GFX_GETBOARDINFO (GFX_BASE+2)
#define GFX_ATTACH_BOARD (GFX_BASE+3)
#define GFX_DETACH_BOARD (GFX_BASE+4)
#define GFX_IS_MANAGED (GFX_BASE+5)
/* Have to be the board owner to use these */
#define GFX_INITIALIZE (GFX_BASE+6)
#define GFX_START (GFX_BASE+7)
#define GFX_DOWNLOAD (GFX_BASE+8)
#define GFX_BLANKSCREEN (GFX_BASE+9)
#define GFX_MAPALL (GFX_BASE+10)
#define GFX_LABEL (GFX_BASE+11)
#define GFX_REATTACH_BOARD (GFX_BASE+12)
#define GFX_SET_DIAG_FLAG (GFX_BASE+13)
/* XXX for debugging, remove later */
#define GFX_DEBUGMAP (GFX_BASE+100)
#define GFX_DUMMY (GFX_BASE+101)
/* Start of board private commands */
#define GFX_PRIVATE_BASE 10000
/*
* gfx ioctl arguments
*/
struct gfx_getboardinfo_args {
unsigned long int board; /* board number (contiguous from zero) */
void *buf; /* buffer for reply */
unsigned long len; /* max length, length of reply (bytes) */
};
struct gfx_attach_board_args {
unsigned long int board;
unsigned long int vaddr;
};
struct gfx_download_args { /* GFX_DOWNLOAD */
long int len; /* length in bytes of ucode buffer */
void *addr; /* address of ucode buffer */
long magic; /* magic number in ucode file */
long unit; /* unit number to load ucode into */
long off; /* offset in memory space where ucode goes */
long width; /* width in bytes of ucode word */
long entry; /* entry point (if applicable) */
long run; /* run flag (should the engine be started?) */
};
#define GFX_DOWNLOAD_LIMIT 4096
struct gfx_private_args {
unsigned long int cmd;
char data[1];
};
/*
* M_PROTO message types for gfx STREAM
*/
#define GFX_PROTO_ACK 1
#define GFX_PROTO_NACK -1
#define GFX_PROTO_BASE 100
#define GFX_POSCURSOR (GFX_PROTO_BASE+2)
/*
* PROTO message args
*/
struct gfx_poscursor {
long int cmd; /* GFX_POSCURSOR */
long int x ;
long int y ;
};
union gfx_proto {
long int cmd; /* may be unknown */
struct gfx_poscursor poscursor;
};
/*
* Graphics board description
*/
#define GFX_INFO_NAME_SIZE 16
#define GFX_INFO_LABEL_SIZE 16
struct gfx_info {
char name[GFX_INFO_NAME_SIZE]; /* unique name for this graphics */
char label[GFX_INFO_LABEL_SIZE];/* manager's name for this board */
unsigned short int xpmax; /* screen x size in pixels */
unsigned short int ypmax; /* screen y size in pixels */
unsigned int length; /* size of a complete info struct */
/* for this board */
};
#define GFX_SYNC_VALUE 3
#ifdef _KERNEL
/*
* Device independent interface to device dependent graphics board functions.
*/
struct gfx_fncs {
/* functions for the Graphics Driver */
int (*gf_Info)(struct gfx_data *, void *, unsigned int);
int (*gf_Attach)(struct gfx_gfx *, unsigned long int);
int (*gf_Detach)(struct gfx_gfx *);
int (*gf_Initialize)(struct gfx_gfx *);
int (*gf_Download)(struct gfx_gfx *, struct gfx_download_args *);
int (*gf_Start)(struct gfx_gfx *);
int (*gf_PositionCursor)();
int (*gf_Sync)(unsigned int);
/* functions for the Rendering Resource Manager */
int (*gf_CreateDDRN)(struct gfx_data *, struct rrm_rnode *);
int (*gf_DestroyDDRN)(struct gfx_data *, struct gfx_gfx *, struct rrm_rnode *);
int (*gf_ValidateClip)(struct gfx_gfx *, struct rrm_rnode *,
struct rrm_rnode *, struct RRM_ValidateClip *);
int (*gf_MapGfx)(struct gfx_gfx *, long, long);
int (*gf_UnMapGfx)(struct gfx_gfx *);
int (*gf_InvalTLB)(struct gfx_gfx *);
int (*gf_PcxSwap)(struct gfx_data *, struct rrm_rnode *,
struct rrm_rnode *, struct rrm_rnode *);
int (*gf_PcxSwitch)(struct gfx_data *, struct rrm_rnode *,
struct rrm_rnode *);
int (*gf_SchedSwapBuf)(struct gfx_data *, struct rrm_rnode *,long,long);
int (*gf_UnSchedSwapBuf)(struct gfx_gfx *, struct rrm_rnode *, long);
int (*gf_SchedRetraceEvent)(struct gfx_data *, struct rrm_rnode *);
int (*gf_SetDisplayMode)(struct gfx_gfx *, long, unsigned long);
int (*gf_Suspend)(struct gfx_data*, struct gfx_gfx *);
int (*gf_Resume)(struct gfx_data*, struct gfx_gfx *);
/*
* routine to call graphics board driver specific functions.
*/
int (*gf_Private)(struct gfx_gfx*, struct rrm_rnode *,
unsigned long, void *);
/*
* provide a pointer to appropriate spl?() routines for
* the given hardware.
*/
int (*gf_SplRetrace)();
};
static struct gfx_board {
struct gfx_info *gb_info ;
struct gfx_gfx *gb_manager;
struct gfx_gfx *gb_owner;
int gb_number; /* same as index in GfxBoards */
struct queue *gb_rq_ptr;
struct queue *gb_wq_ptr;
/* gunk for talking to shimq */
short int gb_devminor ; /* Identifies the shmiq */
short int gb_index ; /* Identifies the device */
struct gfx_fncs *gb_fncs ;
struct gfx_data *gb_data ;
} ;
/*
* gfx driver structure
* one of these per open board, per process
*/
struct gfx_gfx {
/* generic stuff */
struct gfx_board *gx_board; /* pointer to board */
struct proc *gx_pp; /* proc pointer */
struct gfx_gfx *gx_next; /* ptr to next open gfx */
/* board driver stuff */
struct gfx_fncs *gx_fncs;
struct gfx_data *gx_bdata; /* ptr to driver private data */
/* there are many of these pointers */
/* but only one copy of the data */
struct pregion *gx_preg;
unsigned long int gx_flags; /* flags needed by char side only */
unsigned long int gx_sflags; /* flags needed by both sides */
unsigned long int gx_tlbmask; /* for late TLB flushing on (MP) */
/* rrm stuff */
void *gx_openrns; /* RN's this gfx has open */
void *gx_boundrn; /* RN this gfx is currently bound to */
/* share group fields */
sema_t gx_sema; /* semaphore for multiple sg procs */
};
/*
* Values for gfx_gfx.gx_flags
*/
#define GFX_MAPPED 0x00000001
#define GFX_DIAGMAPALL 0x00000002 /* The pipe is mapped in a special way for diagnostic use */
#define GFX_DIAG_FLAG 0x00000004 /* the process has identified itself as a diagnostic */
/*
* Values for gfx_gfx.gx_sflags
*/
#define GFXS_STREAM 0x00000001 /* referenced by streams side of driver */
#define GFXS_CHAR 0x00000002 /* referenced by character side of driver */
struct gfx_data {
/* for the Rendering Resource Manager */
void *currentrn; /* Current rendering node */
long int numrns; /* number of RN's open on this board */
long int numpcx; /* number of pipe contexts in hardware*/
struct rrm_rnode **loadedpcxs; /* table of pipe contexts loaded
in hardware */
struct rrm_rnode *newestrn; /* most recently used rnp
(pcxid allocation) */
struct rrm_rnode *oldestrn; /* least recently used rnp
(pcxid allocation) */
lock_t lock; /* per board locking mechanism */
sema_t gfxsema; /* The gfx semaphore is held during all
times the process has the pipe
mapped. It is also necessary to
hold it during modification of
rnp->validmask, even if the process
doesn't have the pipe. Unless the
gfxlock is non-zero, the process will
give up gfxsema during times when it
is _not_ running (see rrmSuspend()
and rrmResume()).
*/
struct gfx_gfx *gfxsema_owner; /* When the semaphore is grabbed, this
is set to the current gfxp. It is
used to avoid re-grabbing gfxsema.
*/
int gfxlock; /* The lock is used so that even when a
process sleeps it will hold gfxsema.
This is necessary in ValidateMyPcx,
and in some machine dependent code.
*/
int gfxbusylock; /* when a process switches out, if the
device dependent graphics driver decides
that its not an opportune time to context
switch the graphics (based on user activity)
then we can force the state of gfxlock to
hold off a graphics context switch.
*/
long int nummodes; /* number of mode registers in
hardware*/
unsigned long *loadedmodes; /* table of mode registers loaded
in hardware */
volatile int gfxbackedup; /* flag set by fifo interrupt handler when
* fifo is near full and we shouldn't drop
* anymore tokens
*/
};
/*
* args to GfxKiller() routine called by procscan()
*/
struct GfxKiller_args { /* arg struct given to procscan() */
long int signal; /* signal to send */
struct gfx_data *bdata; /* pointer to board data; identifies a board */
struct proc *pp; /* your proc pointer if you shouldn't be killed
(e.g. board manager exits), NULL otherwise */
};
/*
* Multiple reader, single writer lock routines for list rooted at pp->p_gfx.
*/
extern int GfxKiller(struct proc *, struct GfxKiller_args *, int);
extern int GfxListWriterLock(struct shaddr_s *);
extern void GfxListWriterUnlock(struct shaddr_s *, int);
extern void GfxListReaderLock(struct shaddr_s *);
extern void GfxListReaderUnlock(struct shaddr_s *);
#endif /* _KERNEL */
#endif /* __SYS_GFX_H__ */